// 订单模型
const { Orders } = require('../../../models/order');

// 统一数据返回类
const { DataReturn } = require('../../../common/returnclass');

/**
 * @api {Put} /orders/sendOutGoods 订单发货
 * @apiGroup Admin-Orders
 *
 * @apiParam {String} _id 用户id
 * @apiParam {Array} receiving_address 收货地址
 *
 * @apiSuccess {Number} code 状态码
 * @apiSuccess {Object} data 返回数据
 * @apiSuccess {String} msg  返回消息
 */
module.exports = async (req, res) => {
	let { _id ,is_send } = req.fields;
	console.log('465',req.fields);
	
	// 更新地址信息 发货后改为待收货状态 2
	Orders.updateOne({_id}, {is_send:is_send,state:2})
	.then(()=>{
		DataReturn.getData(res,200,[],'发货成功')
	}).catch(()=>{
		DataReturn.getData(res,400,[],'发货失败')
	})


}